import sys, pygame, unittest
from enemy import Enemy

def get_spread(val, range=5):
    min_value = val * ( 1 - (range / 100))
    max_value = val * ( 1 + (range / 100))
    return min_value, max_value

def check_val_in_range(val,range=5):
    min_val,max_val = get_spread(val, range)
    if ((val >= min_val) & (val <= max_val)):
        return True
    else:
        return False

def check_direction_of_path(map,enemy):
    map.get_at(enemy.xy())

    if pygame.color.Color.r((map.get_at(enemy.xy()))):
        print 'finish me';

class ToolsTestCase(unittest.TestCase):
    def testGetSpread(self):
        self.assertEquals((95,105), get_spread(100));

    def testCheckValInRange(self):
        self.assertTrue(check_val_in_range(100));

    def testCheckDirectionOfPath(self):
	self.fail("write this test");


if __name__ == '__main__':
    unittest.main();

